@use '@material/circular-progress' as mdc-circular-progress;
@use '../mdc-helpers/mdc-helpers';
@use '../../material/core/theming/theming';

@mixin _mat-mdc-progress-spinner-color($color) {
  @include mdc-circular-progress.color($color, $query: mdc-helpers.$mat-theme-styles-query);
}

@mixin color($config-or-theme) {
  $config: theming.get-color-config($config-or-theme);
  @include mdc-helpers.mat-using-mdc-theme($config) {
    .mat-mdc-progress-spinner {
      @include _mat-mdc-progress-spinner-color(primary);

      &.mat-accent {
        @include _mat-mdc-progress-spinner-color(secondary);
      }

      &.mat-warn {
        @include _mat-mdc-progress-spinner-color(error);
      }
    }
  }
}

@mixin typography($config-or-theme) {}

@mixin density($config-or-theme) {}

@mixin theme($theme-or-color-config) {
  $theme: theming.private-legacy-get-theme($theme-or-color-config);
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-progress-spinner') {
    $color: theming.get-color-config($theme);
    $density: theming.get-density-config($theme);
    $typography: theming.get-typography-config($theme);

    @if $color != null {
      @include color($color);
    }
    @if $density != null {
      @include density($density);
    }
    @if $typography != null {
      @include typography($typography);
    }
  }
}
